﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Nonocast.Scheduling.UnitTest {
	[TestClass]
	public class OnceUnitTest {
		[TestMethod]
		public void TestMethod1() {
			//var once = new Once<Bag>().From("23:55").Until("23:59").Today().Cast<Bag>();
			//var task = once.Generate();
			//Assert.IsNotNull(task);
			//Assert.IsNull(once.Generate(task));
		}

		[TestMethod]
		public void TestMethod2() {
			var week = new DaysOfWeek<Bag>().From("00:30").Until("02:00").Wednesday().Cast<Bag>();
			var task = week.Generate();
			Assert.IsNotNull(task);
			Assert.AreEqual(new DateTime(2013, 2, 6), task.StartTime.Date);
			task = week.Generate(task);
			Assert.IsNotNull(task);
			Assert.AreEqual(new DateTime(2013, 2, 13), task.StartTime.Date);
		}

		[TestMethod]
		public void TestMethod3(){
			var week = new DaysOfWeek<Bag>().From("0:32").Until("1:00").EveryDay().Cast<Bag>();
			var task = week.Generate();
			Assert.IsNotNull(task);
			Assert.AreEqual(new DateTime(2013, 2, 6), task.StartTime.Date);
		}
	}

	public class Bag { }
}
